//
// Created by 紫霄 on 2020/3/22.
//

#ifndef CPP_DEMO_DEMO_H
#define CPP_DEMO_DEMO_H


#include <mach/task_info.h>
#include <string>


//class demo {
//
//};

struct demo {
    std::string isbn() const { return bookNO;};
    demo& combine(const demo&);
    double avr_price() const;
    std::string bookNO;
    unsigned sold;
    double revenue = 0.0;


}; // 注意此处的分号

demo& demo::combine(const demo &k){
    sold += k.sold;
    revenue += k.revenue;
    return *this;
}

double demo::avr_price() const {
    return demo::sold? demo::revenue/demo::sold : 0;
}






#endif //CPP_DEMO_DEMO_H
